package com.fcscs.cservice.client.main.reservation;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
import com.fcscs.core.common.MainPaginationSearchModel;
import com.fcscs.core.common.SearchResultsContainer;
import com.fcscs.core.common.authority.CServiceAuthority;
import com.fcscs.core.common.authority.UserAuthority;
import com.fcscs.core.gwt.common.AsyncCallbackListener;
import com.fcscs.core.gwt.common.CoreConstants;
import com.fcscs.core.gwt.common.CoreEnums.SubmitType;
import com.fcscs.core.gwt.common.FormSubmitListener;
import com.fcscs.core.gwt.common.SearchExecutor;
import com.fcscs.core.gwt.common.SessionContext;
import com.fcscs.core.gwt.common.ui.FcsFields.ClearElementCombobox;
import com.fcscs.core.gwt.common.ui.FcsFields.EasyClearCombobox;
import com.fcscs.core.gwt.common.ui.FcsFields.FormButton;
import com.fcscs.core.gwt.common.ui.FcsFormPanel;
import com.fcscs.core.gwt.common.ui.FcsPanel;
import com.fcscs.cservice.client.common.CServiceConstants;
import com.fcscs.cservice.client.common.TextFieldAndIconButtonField;
import com.fcscs.cservice.client.common.TextFieldAndIconButtonField.TextFieldListener;
import com.fcscs.cservice.client.common.controller.CServiceCommonServiceController;
import com.fcscs.cservice.client.common.controller.ReservationServiceController;
import com.fcscs.cservice.client.common.model.reservation.AdvancedSearchTermModel;
import com.fcscs.cservice.client.common.model.reservation.ReservationStatusModelData;
import com.fcscs.cservice.client.common.model.reservation.ReservationViewModelData;
import com.fcscs.cservice.client.common.model.reservation.RoomStatusModelData;
import com.fcscs.cservice.domain.model.CountryView;
import com.fcscs.cservice.domain.model.ReservationConfView;
import com.fcscs.cservice.domain.model.ReservationConfView.ReservationStatus;
import com.fcscs.cservice.domain.model.ReservationView;
import com.fcscs.share.gwt.common.ShareGWTConstants;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget;

public class ReservationPanel extends FcsPanel {

	private VerticalPanel vp;
	private TextFieldAndIconButtonField searchFieldBtn ;
	private FormButton advancedSearchButton;
	private ClearElementCombobox<ReservationStatusModelData> reservationStatusCombobox;
	private ListStore<ReservationStatusModelData> reservationStatusListStore;
	private AdvancedSearchDialog advancedSearchDialog;
	public static ReservationGrid grid;
    private boolean isAdvancedSearch;
    private List<ReservationViewModelData> reservationViewModelList;
    private AdvancedSearchTermModel advancedSearchTerm;
    private ReservationConfView reservationConf;
    private boolean isClearResvStatus;
    
	public ReservationPanel(String id) {
		super(id);
	}

	@Override
	public void init() {
		if(null == vp){
		    vp = new VerticalPanel();
		    vp.setId("ReservationPanel_vp");
			vp.setSpacing(10);
		    
		    FormPanel panel = new FormPanel();
		    panel.setId("ReservationPanel_panel");
			panel.setFrame(true);
			panel.setHeading(CServiceConstants.CSERVICE_CONSTANTS.searchCriteria());
			panel.setPadding(0);
			panel.setSize(950, 50);
			panel.setLabelAlign(LabelAlign.LEFT);
			panel.setLayout(new ColumnLayout());
		
            searchFieldBtn = new TextFieldAndIconButtonField(new TextFieldListener() {
			    @Override
			    public void onTextFieldEnterKeyPressSearch(String value) {
				    if(value == null || value.trim().isEmpty()){
					    newSearch(true);
				    }else{
				    	searchFieldBtn.getTextField().clearInvalid();
					    if (value.trim().length() > 1) {
							newSearch(false);
						}else{
							searchFieldBtn.getTextField().forceInvalid(CServiceConstants.CSERVICE_MESSAGES.atLeastenter(2));
						}
				    }
			    }
			
			    @Override
			    public void onIconButtoSearch(String value) {
				    if(value == null || value.trim().isEmpty()){
					    newSearch(true);
				    }else{
				    	searchFieldBtn.getTextField().clearInvalid();
					    if (value.trim().length() > 1) {
							newSearch(false);
						}else{
							searchFieldBtn.getTextField().forceInvalid(CServiceConstants.CSERVICE_MESSAGES.atLeastenter(2));
						}
				    }
			    }
		    });
            searchFieldBtn.setId("ReservationPanel_searchFieldBtn");
		    searchFieldBtn.getTextField().setWidth(260);
		    searchFieldBtn.getTextField().setEmptyText(
				CoreConstants.CORE_CONSTANTS.lastname() + "," + CoreConstants.CORE_CONSTANTS.firstname()
				+ ShareGWTConstants.SHARE_GWT_CONSTANTS.or()
				+ CServiceConstants.CSERVICE_CONSTANTS.confirmationNO());
		    searchFieldBtn.setIcoButtonTitle(ShareGWTConstants.SHARE_GWT_MESSAGES.searchBy(
				CoreConstants.CORE_CONSTANTS.lastname() + "," + CoreConstants.CORE_CONSTANTS.firstname()
				+ ShareGWTConstants.SHARE_GWT_CONSTANTS.or()
				+ CServiceConstants.CSERVICE_CONSTANTS.confirmationNO()));
		    searchFieldBtn.setStyleAttribute("marginLeft", "100px");
		    searchFieldBtn.setStyleAttribute("marginTop", "10px");
		    searchFieldBtn.getTextField().addListener(Events.OnBlur, new Listener<BaseEvent>(){
				@Override
				public void handleEvent(BaseEvent be) {
					String value = searchFieldBtn.getTextField().getValue();
					if(null != value 
					   && !value.trim().isEmpty()
					   && value.trim().length() < 2){
						searchFieldBtn.getTextField().forceInvalid(CServiceConstants.CSERVICE_MESSAGES.atLeastenter(2));
					}else{
						searchFieldBtn.getTextField().clearInvalid();
					}
				}
		    });
		    panel.add(searchFieldBtn, new ColumnData(.3));
		
		    advancedSearchButton = new FormButton(CServiceConstants.CSERVICE_CONSTANTS.advancedSearch());
		    advancedSearchButton.setId("ReservationPanel_advancedSearchButton");
		    advancedSearchButton.setStyleAttribute("marginLeft", "140px");
		    advancedSearchButton.setStyleAttribute("marginTop", "10px");
		    advancedSearchButton.addSelectionListener(new SelectionListener<ButtonEvent>(){
				@Override
				public void componentSelected(ButtonEvent ce) {
					advancedSearchDialog = AdvancedSearchDialog.getInstance(new FormSubmitListener<ReservationView>(){
						@Override
						public void formSubmitCallBack(
								FcsFormPanel<ReservationView> form,
								SubmitType submitType) {
							newSearch(true);
							advancedSearchDialog.hide();
						}
					}, reservationConf);
					advancedSearchDialog.getFormPanel().updateForm(new ReservationView());
					advancedSearchDialog.show();
					isClearResvStatus = true;
					searchFieldBtn.getTextField().clear();
					reservationStatusCombobox.clear();
					isAdvancedSearch = true;
					isClearResvStatus = false;
				}
		    });
		    panel.add(advancedSearchButton);
		    
		    reservationStatusListStore = new ListStore<ReservationStatusModelData>();
		    reservationStatusCombobox = 
		    	new ClearElementCombobox<ReservationStatusModelData>(new ReservationStatusModelData(new ReservationStatus()));
		    reservationStatusCombobox.setId("ReservationPanel_reservationStatusCombobox");
		    reservationStatusCombobox.setStyleAttribute("marginLeft", "60px");
		    reservationStatusCombobox.setStyleAttribute("marginTop", "10px");
		    reservationStatusCombobox.setEmptyText(CServiceConstants.CSERVICE_CONSTANTS.reservationStatus());
			reservationStatusCombobox.setWidth(200);
			reservationStatusCombobox.setDisplayField(CServiceConstants.STATUS);
			reservationStatusCombobox.setTriggerAction(TriggerAction.ALL);
		    reservationStatusCombobox.setStore(reservationStatusListStore);
		    reservationStatusCombobox.setForceSelection(true);
		    reservationStatusCombobox.setEditable(false);
		    reservationStatusCombobox.addSelectionChangedListener(
		    	new SelectionChangedListener<ReservationStatusModelData>(){
					@Override
					public void selectionChanged(
						SelectionChangedEvent<ReservationStatusModelData> se) {
						if (!isClearResvStatus) {
							searchFieldBtn.getTextField().clear();
							newSearch(true);
						}
					}
		    	});
		    panel.add(reservationStatusCombobox);
		
		    vp.add(panel);
		    
		    grid = ReservationGrid.getINSTANCE(CServiceConstants.CSERVICE_CONSTANTS.reservationView(), new SearchExecutor<ReservationViewModelData, MainPaginationSearchModel>(){
				@Override
				public void doSearch(
						final MainPaginationSearchModel searchModel,
						final AsyncCallback<BasePagingLoadResult<ReservationViewModelData>> callback) {
					if(null == searchModel){
						callback.onSuccess(createEmptyResult(new ArrayList<ReservationViewModelData>()));
						return;
					}
					
					if(isAdvancedSearch){
						isAdvancedSearch = false;
						
						advancedSearchTerm = new AdvancedSearchTermModel();
						
						createAdvancedSearchTerm(
								advancedSearchDialog.searchItemCombo1.getValue().getEnum().getIndex(),1);
						createAdvancedSearchTerm(
								advancedSearchDialog.searchItemCombo2.getValue().getEnum().getIndex(),2);
						createAdvancedSearchTerm(
								advancedSearchDialog.searchItemCombo3.getValue().getEnum().getIndex(),3);
						
						ReservationServiceController.getINSTANCE().findReservations(
								advancedSearchTerm.getFirstName(), 
								advancedSearchTerm.getLastName(), 
								advancedSearchTerm.getRsvStatus(), 
								advancedSearchTerm.getRoomNo(), 
								advancedSearchTerm.getMemberNo(), 
								advancedSearchTerm.getRoomStatus(), 
								advancedSearchTerm.getBaggageNo(), 
								advancedSearchTerm.getArrivDate(), 
								advancedSearchTerm.getDepartDate(), 
								advancedSearchTerm.getEta(), 
								advancedSearchTerm.getEtd(), 
                                new Date(), 
                                searchModel, 
								new AsyncCallbackListener<SearchResultsContainer<ReservationView>>(){
									@Override
									public void onLogin(String username) {
										ReservationServiceController.getINSTANCE().findReservations( 
												advancedSearchTerm.getFirstName(), 
												advancedSearchTerm.getLastName(), 
												advancedSearchTerm.getRsvStatus(), 
												advancedSearchTerm.getRoomNo(), 
												advancedSearchTerm.getMemberNo(), 
												advancedSearchTerm.getRoomStatus(), 
												advancedSearchTerm.getBaggageNo(), 
												advancedSearchTerm.getArrivDate(), 
												advancedSearchTerm.getDepartDate(), 
												advancedSearchTerm.getEta(), 
												advancedSearchTerm.getEtd(), 
				                                new Date(), 
				                                searchModel, this);										
									}

									@Override
									public void onFailure(Throwable caught) {
										MessageBox.alert(CoreConstants.CORE_MESSAGES.operation(CoreConstants.CORE_CONSTANTS.system(), ShareGWTConstants.SHARE_GWT_CONSTANTS.error()),
												CoreConstants.CORE_CONSTANTS.systemError(), null);
									}

									@Override
									public void onSuccess(
											SearchResultsContainer<ReservationView> result) {
										reservationViewModelList = new ArrayList<ReservationViewModelData>();
										for(ReservationView rv : result.getResults()){
											reservationViewModelList.add(new ReservationViewModelData(rv));
										}
										callback.onSuccess(FcsPanel.createPagingLoadResult(reservationViewModelList,searchModel.getCurrentPage(),
												searchModel.getResultsPerPage(),result.getTotalCnt()));
									}
									
								});
					}else{
						ReservationServiceController.getINSTANCE().findReservations(
							(null == reservationStatusCombobox.getValue())
							    ? null
							    : reservationStatusCombobox.getValue().getEntity().getReservStatusId(), 
							searchModel, new AsyncCallbackListener<SearchResultsContainer<ReservationView>>(){

									@Override
									public void onLogin(String username) {
										ReservationServiceController.getINSTANCE().findReservations(
												(null == reservationStatusCombobox.getValue())
												    ? null
												    : reservationStatusCombobox.getValue().getEntity().getReservStatusId(), 
												searchModel,this);
									}

									@Override
									public void onFailure(Throwable caught) {
										MessageBox.alert(CoreConstants.CORE_MESSAGES.operation(CoreConstants.CORE_CONSTANTS.system(), ShareGWTConstants.SHARE_GWT_CONSTANTS.error()),
												CoreConstants.CORE_CONSTANTS.systemError(), null);
									}

									@Override
									public void onSuccess(
											SearchResultsContainer<ReservationView> result) {
										reservationViewModelList = new ArrayList<ReservationViewModelData>();
										for(ReservationView rv : result.getResults()){
											reservationViewModelList.add(new ReservationViewModelData(rv));
										}
										callback.onSuccess(FcsPanel.createPagingLoadResult(reservationViewModelList,searchModel.getCurrentPage(),
												searchModel.getResultsPerPage(),result.getTotalCnt()));
									}
							
						});
					}
				}
		    });
		    grid.setId("ReservationPanel_grid");
		    
		    vp.add(grid);
		    
		    add(vp);
		}
		onShow();
	}

	@Override
	public UserAuthority getRequiredAuthority() {
		return CServiceAuthority.cSERVICE_RESV;
	}

	@Override
	protected Widget getViewPanel() {
		return vp;
	}

	@Override
	public void onShow() {
		newSearch(true);
		loadReservConf();
		
	}

	@Override
	public boolean onHide() {
		isAdvancedSearch = false;
		isClearResvStatus = true;
		searchFieldBtn.getTextField().clear();
		reservationStatusCombobox.clear();
		isClearResvStatus = false;
		grid.clear();
		return true;
	}

	private void loadReservConf(){
		reservationStatusListStore.removeAll();
		CServiceCommonServiceController.getINSTANCE().getRsvConfView(
			SessionContext.getInstance().getPropertyId(), 
			new AsyncCallbackListener<ReservationConfView>(){
				@Override
				public void onLogin(String username) {
					CServiceCommonServiceController.getINSTANCE().getRsvConfView(
						SessionContext.getInstance().getPropertyId(),this);
				}
				@Override
				public void onFailure(Throwable caught) {
					MessageBox.alert(CoreConstants.CORE_MESSAGES.operation(CoreConstants.CORE_CONSTANTS.system(), ShareGWTConstants.SHARE_GWT_CONSTANTS.error()),
						CoreConstants.CORE_CONSTANTS.systemError(), null);
				}
				@Override
				public void onSuccess(ReservationConfView result) {
					if(null != result){
						reservationConf = result;
						grid.setReservationConf(result);
						for(ReservationStatus rs : result.getReservationStatusList()){
							reservationStatusListStore.add(new ReservationStatusModelData(rs));
						}
					}
				}
			});
		CServiceCommonServiceController.getINSTANCE().getCountries(
				SessionContext.getInstance().getPropertyId(), 
				new AsyncCallbackListener<List<CountryView>>(){
					@Override
					public void onLogin(String username) {
						CServiceCommonServiceController.getINSTANCE().getCountries(
								SessionContext.getInstance().getPropertyId(),this);
					}
					@Override
					public void onFailure(Throwable caught) {
						MessageBox.alert(
							CoreConstants.CORE_MESSAGES.operation(
								CoreConstants.CORE_CONSTANTS.system(), 
								ShareGWTConstants.SHARE_GWT_CONSTANTS.error()),
							CoreConstants.CORE_CONSTANTS.systemError(), null);
					}
					@Override
					public void onSuccess(List<CountryView> result) {
						if(result != null){
							grid.setCountryList(result);
						}
					}
				});
	}
	
	protected void newSearch(boolean all) {
		String term = null;
		if(all){
			term=null;
		}else{
			if(searchFieldBtn.getTextFieldValue()==null || searchFieldBtn.getTextFieldValue().trim().isEmpty()){
				MessageBox.alert(null,
					CoreConstants.CORE_CONSTANTS.enterSearchTermSimple(),new Listener<MessageBoxEvent>() {
						@Override
						public void handleEvent(MessageBoxEvent be) {
							searchFieldBtn.getTextField().focus();
						}
				});
			}else{
				term=searchFieldBtn.getTextFieldValue().trim();
			}
		}
		MainPaginationSearchModel sm = new MainPaginationSearchModel();
		sm.setSearchTerm(term);
		grid.newSearch(sm);
	}
	
	private void createAdvancedSearchTerm(int code,int row){
		switch(code){
		    case 0:
		    	switch(row){
		    	    case 1:
		    	    	advancedSearchTerm.setFirstName(getTextFieldValue(advancedSearchDialog.firstName1));
		    	    	advancedSearchTerm.setLastName(getTextFieldValue(advancedSearchDialog.lastName1));
		    	    	break;
		    	    case 2:
		    	    	advancedSearchTerm.setFirstName(getTextFieldValue(advancedSearchDialog.firstName2));
		    	    	advancedSearchTerm.setLastName(getTextFieldValue(advancedSearchDialog.lastName2));
		    	    	break;
		    	    case 3:
		    	    	advancedSearchTerm.setFirstName(getTextFieldValue(advancedSearchDialog.firstName3));
		    	    	advancedSearchTerm.setLastName(getTextFieldValue(advancedSearchDialog.lastName3));
		    	    	break;
		    	}
		    	break;
		    case 1:
		    	switch(row){
	    	    case 1:
	    	    	advancedSearchTerm.setRsvStatus(getReservationStatus(advancedSearchDialog.reservationStatusCombo1));
	    	    	break;
	    	    case 2:
	    	    	advancedSearchTerm.setRsvStatus(getReservationStatus(advancedSearchDialog.reservationStatusCombo2));
	    	    	break;
	    	    case 3:
	    	    	advancedSearchTerm.setRsvStatus(getReservationStatus(advancedSearchDialog.reservationStatusCombo3));
	    	    	break;
	    	    }
	    	    break;
		    case 2:
		    	switch(row){
	    	    case 1:
	    	    	advancedSearchTerm.setRoomNo(getTextFieldValue(advancedSearchDialog.roomNo1));
	    	    	break;
	    	    case 2:
	    	    	advancedSearchTerm.setRoomNo(getTextFieldValue(advancedSearchDialog.roomNo2));
	    	    	break;
	    	    case 3:
	    	    	advancedSearchTerm.setRoomNo(getTextFieldValue(advancedSearchDialog.roomNo3));
	    	    	break;
	    	    }
	    	    break;
		    case 3:
		    	switch(row){
	    	    case 1:
	    	    	advancedSearchTerm.setMemberNo(getTextFieldValue(advancedSearchDialog.memberShipNo1));
	    	    	break;
	    	    case 2:
	    	    	advancedSearchTerm.setMemberNo(getTextFieldValue(advancedSearchDialog.memberShipNo2));
	    	    	break;
	    	    case 3:
	    	    	advancedSearchTerm.setMemberNo(getTextFieldValue(advancedSearchDialog.memberShipNo3));
	    	    	break;
	    	    }
	    	    break;
		    case 4:
		    	switch(row){
	    	    case 1:
	    	    	advancedSearchTerm.setRoomStatus(getRoomStatus(advancedSearchDialog.roomStatusCombo1));
	    	    	break;
	    	    case 2:
	    	    	advancedSearchTerm.setRoomStatus(getRoomStatus(advancedSearchDialog.roomStatusCombo2));
	    	    	break;
	    	    case 3:
	    	    	advancedSearchTerm.setRoomStatus(getRoomStatus(advancedSearchDialog.roomStatusCombo3));
	    	    	break;
	    	    }
	    	    break;
		    case 5:
		    	switch(row){
	    	    case 1:
	    	    	advancedSearchTerm.setBaggageNo(getTextFieldValue(advancedSearchDialog.baggageNo1));
	    	    	break;
	    	    case 2:
	    	    	advancedSearchTerm.setBaggageNo(getTextFieldValue(advancedSearchDialog.baggageNo2));
	    	    	break;
	    	    case 3:
	    	    	advancedSearchTerm.setBaggageNo(getTextFieldValue(advancedSearchDialog.baggageNo3));
	    	    	break;
	    	    }
	    	    break;
		    case 6:
		    	switch(row){
	    	    case 1:
	    	    	advancedSearchTerm.setArrivDate(advancedSearchDialog.dateField1.getValue());
	    	    	if(advancedSearchDialog.timeField1.getRawValue() != null
	    	    	    && !advancedSearchDialog.timeField1.getRawValue().trim().isEmpty()){
	    	    	    advancedSearchTerm.setEta(CServiceConstants.DATE_FORMAT2.parse(advancedSearchDialog.timeField1.getRawValue().trim()));
	    	    	}
	    	    	break;
	    	    case 2:
	    	    	advancedSearchTerm.setArrivDate(advancedSearchDialog.dateField2.getValue());
	    	    	if(advancedSearchDialog.timeField2.getRawValue() != null
		    	    	    && !advancedSearchDialog.timeField2.getRawValue().trim().isEmpty()){
		    	    	    advancedSearchTerm.setEta(CServiceConstants.DATE_FORMAT2.parse(advancedSearchDialog.timeField2.getRawValue().trim()));
		    	    	}
	    	    	break;
	    	    case 3:
	    	    	advancedSearchTerm.setArrivDate(advancedSearchDialog.dateField3.getValue());
	    	    	if(advancedSearchDialog.timeField3.getRawValue() != null
		    	    	    && !advancedSearchDialog.timeField3.getRawValue().trim().isEmpty()){
		    	    	    advancedSearchTerm.setEta(CServiceConstants.DATE_FORMAT2.parse(advancedSearchDialog.timeField3.getRawValue().trim()));
		    	    	}
	    	    	break;
	    	    }
	    	    break;
		    case 7:
		    	switch(row){
	    	    case 1:
	    	    	advancedSearchTerm.setDepartDate(advancedSearchDialog.dateField1.getValue());
	    	    	advancedSearchTerm.setEtd(advancedSearchDialog.timeField1.getDateValue());
	    	    	break;
	    	    case 2:
	    	    	advancedSearchTerm.setDepartDate(advancedSearchDialog.dateField2.getValue());
	    	    	advancedSearchTerm.setEtd(advancedSearchDialog.timeField2.getDateValue());
	    	    	break;
	    	    case 3:
	    	    	advancedSearchTerm.setDepartDate(advancedSearchDialog.dateField3.getValue());
	    	    	advancedSearchTerm.setEtd(advancedSearchDialog.timeField3.getDateValue());
	    	    	break;
	    	    }
	    	    break;
		}
	}
	
	private String getTextFieldValue(TextField<String> field){
		String value = null;
		if(field.getValue() != null && !(field.getValue().trim().isEmpty())){
			value = field.getValue().trim();
		}
		return value;
	}
	
	private Long getReservationStatus(EasyClearCombobox<ReservationStatusModelData> combo){
		Long value = null;
		if(combo.getValue() != null){
			value = combo.getValue().getEntity().getReservStatusId();
		}
		return value;
	}
	
	private Long getRoomStatus(EasyClearCombobox<RoomStatusModelData> combo){
		Long value = null;
		if(combo.getValue() != null){
			value = combo.getValue().getEntity().getRoomStatusId();
		}
		return value;
	}

	@Override
	public void setFocus() {
		searchFieldBtn.getTextField().focus();
	}
}
